/* input should be an integer no larger than `maxn`, as `n`
 * output should be like this, with n rows and n columns
 *   1  2  3  4  5
 *  12 13 14  6  0
 *  11 15  7  0  0
 *  10  8  0  0  0
 *   9  0  0  0  0
 */
#include<bits/stdc++.h>
using namespace std;
const int maxn = 100;
int a[maxn][maxn];
int main() {
  // freopen("input.txt", "r", stdin);
  // freopen("output.txt", "w", stdout);
  // Amazing bugs occured.
  int n;
  while(cin >> n) {
    const int t = (n*n + n) / 2;
    int x, y;
    int i=0;
    memset(a, 0x0, sizeof(a));
    a[x=0][y=0]=++i;
    do{
      while(x+1!=n && !a[x+1][y]) a[++x][y] = ++i;
      while(y+1!=n && !a[x-1][y+1]) a[--x][++y] = ++i;
      while(y-1!=-1 && !a[x][y-1]) a[x][--y] = ++i;
    }while(i!=t);

    for(y=0; y<n; ++y){
      for(x=0; x<n; ++x)
        printf("%5d", a[x][y]);
      printf("\n");
    }
  }
  return 0;
}
